package test.unit
{
	import com.zanshine.benchmark.api.BenchmarkSuite;
	import com.zanshine.benchmark.api.PrinterTarget;
	import com.zanshine.benchmark.core.ResultPrinter;
	import com.zanshine.benchmark.core.TracePrinterTarget;
	import com.zanshine.benchmark.core.events.PrinterEvent;
	
	import flash.utils.describeType;
	
	import net.digitalprimates.fluint.tests.TestCase;
	
	import test.mock.BenchTestMock;

	public class TracePrinterTargetTest extends TestCase
	{
		/**
		 * 
		 */
		public function testOutput():void
		{
			var suite:BenchmarkSuite = new BenchmarkSuite;
			suite.addBenchmark(new BenchTestMock);
			
			var printer:ResultPrinter = new ResultPrinter(suite);
			printer.addEventListener(PrinterEvent.RESULT_PRINTED, asyncHandler(async_testOutput, 50));
			
			suite.run();
		}
		
		private function async_testOutput(event:PrinterEvent, data:Object):void
		{
			var pt:PrinterTarget = (event.target as ResultPrinter).printerTarget;
			var constants:XMLList = describeType(TracePrinterTarget).constant;
			var output:String = pt.output,
				node:XML;
			
			for each(node in constants)
			{
				var message:String = TracePrinterTarget[node.@name] + " => ";
				assertTrue(message, output.indexOf(message) > -1);
			}
		}
		
		/**
		 * 
		 */
		
	}
}